/* ══════════════════════════════════════════════════════════
   RESET acotado al componente (sin afectar resto de SharePoint)
   ══════════════════════════════════════════════════════════ */
.portal-v1,
.portal-v1 *,
.portal-v1 *::before,
.portal-v1 *::after {
  box-sizing: border-box;
}

/* ══════════════════════════════════════════════════════════
   PORTAL V1 — contenedor general
   ══════════════════════════════════════════════════════════ */
.portal-v1 {
  background: #EEEDFE;
  padding: 0 0 56px;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #1a1a1a;
}

.portal-v1__inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ══════════════════════════════════════════════════════════
   BOCETO-HEADER — encabezado del componente
   ══════════════════════════════════════════════════════════ */
.boceto-header {
  padding: 56px 0 8px;
  text-align: center;
}

.boceto-header__tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #9188C4;
  margin-bottom: 20px;
}

/* Título: usamos div con role=heading. Reforzamos con !important
   para evitar conflictos con .ms-rtestate-field h2 global de SP */
.portal-v1 .boceto-header .boceto-header__titulo {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif !important;
  font-size: clamp(40px, 5.5vw, 72px) !important;
  font-weight: 900 !important;
  color: #2E2666 !important;
  line-height: 0.95 !important;
  letter-spacing: -0.03em !important;
  margin: 0 0 20px !important;
  padding: 0 !important;
  border: none !important;
  text-transform: none !important;
  text-align: center !important;
  display: block !important;
}

.portal-v1 .boceto-header__titulo em {
  font-style: normal;
  color: #3C3489 !important;
}

.boceto-header__sub {
  font-size: clamp(18px, 1.8vw, 22px);
  color: #7B72B0;
  margin: 0 auto;
  max-width: 560px;
  line-height: 1.55;
  font-weight: 400;
}

/* ══════════════════════════════════════════════════════════
   GRID Y ESTADOS DE CARGA
   ══════════════════════════════════════════════════════════ */
.portal-v1__grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  min-height: 200px;
}

.portal-v1__loading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 80px 20px;
  color: #7B72B0;
  font-size: 15px;
}

.portal-v1__spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(60, 52, 137, 0.2);
  border-top-color: #4C3DC9;
  border-radius: 50%;
  animation: v1-spin 0.8s linear infinite;
}

@keyframes v1-spin { to { transform: rotate(360deg); } }

.portal-v1__error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: #B91C1C;
  background: #FEE2E2;
  border-radius: 12px;
}

/* ══════════════════════════════════════════════════════════
   FLIP CARD
   ══════════════════════════════════════════════════════════ */
.v1-flip {
  perspective: 1200px;
  height: 400px;
  border-radius: 14px;
  border: 1px solid rgba(60, 52, 137, 0.13);
}

.v1-flip__inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.65s cubic-bezier(0.4, 0.2, 0.2, 1);
}

/* Las inactivas NO giran al pasar el mouse */
.v1-flip:not(.v1-flip--inactiva):hover .v1-flip__inner,
.v1-flip--activa .v1-flip__inner,
.v1-flip--flipped .v1-flip__inner {
  transform: rotateY(180deg);
}

.v1-flip--inactiva {
  opacity: 0.45;
  pointer-events: none;
  filter: saturate(0.6);
  transition: opacity 0.35s, filter 0.35s;
}

/* Caras */
.v1-flip__front,
.v1-flip__back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 13px;
}

/* ── Frente ───────────────────────────────────────────── */
.v1-flip__front {
  background: linear-gradient(160deg, #fff 30%, var(--v1-tint, #EEEDFE) 100%);
  padding: 20px 20px 16px;
  justify-content: space-between;
}

.v1-flip__front-top {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  text-align: center;
}

.v1-flip__rule {
  border: none;
  border-top: 1px solid var(--v1-front-accent, #4C3DC9);
  opacity: 0.2;
  margin: 0;
  width: 100%;
}

.v1-flip__label {
  font-size: 13px;
  font-weight: 400;
  color: #7B72B0;
  letter-spacing: 0.01em;
}

.v1-flip__display {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 12px 0;
}

.v1-flip__verbo {
  font-size: clamp(26px, 3vw, 42px);
  font-weight: 900;
  line-height: 1;
  color: #2E2666;
  letter-spacing: -0.03em;
  display: block;
}

.v1-flip__front-bottom {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.v1-flip__necesidad {
  font-size: 13px !important;
  color: #555 !important;
  font-style: italic !important;
  line-height: 1.45 !important;
  margin: 0 !important;
}

.v1-flip__front-foot {
  display: flex;
  align-items: center;
  gap: 8px;
}

.v1-flip__num {
  font-size: 13px;
  font-weight: 400;
  color: var(--v1-front-accent, #4C3DC9);
  flex: 1;
  opacity: 0.6;
}

.v1-flip__hint {
  font-size: 10px;
  color: #aaa;
  letter-spacing: 0.05em;
}

.v1-flip__plus {
  width: 32px;
  height: 32px;
  background: var(--v1-front-accent, #4C3DC9);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 300;
  flex-shrink: 0;
  line-height: 1;
}

/* ── Reverso ──────────────────────────────────────────── */
.v1-flip__back {
  transform: rotateY(180deg);
  background: var(--v1-bg, #1E1A4A);
  color: var(--v1-accent, #C4B8FF);
  padding: 22px 18px 16px;
  justify-content: flex-start;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Título del reverso reforzado contra .ms-rtestate-field h3 */
.portal-v1 .v1-flip .v1-flip__back-titulo {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif !important;
  font-size: clamp(20px, 1.8vw, 26px) !important;
  font-weight: 800 !important;
  line-height: 1.1 !important;
  letter-spacing: -0.02em !important;
  color: #fff !important;
  text-align: center !important;
  margin: 0 0 4px !important;
  padding: 0 !important;
  border: none !important;
  text-transform: none !important;
  display: block !important;
}

.v1-flip__back-lista {
  list-style: none;
  padding: 8px 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.v1-flip__back-lista::-webkit-scrollbar { width: 3px; }
.v1-flip__back-lista::-webkit-scrollbar-track { background: transparent; }
.v1-flip__back-lista::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
}

.v1-flip__back-lista li { font-size: 13px; }

/* Enlaces: estado base sólido */
.v1-flip__back-lista a {
  text-decoration: none;
  font-weight: 400;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 3px 0;
  color: var(--v1-accent, #C4B8FF);
  opacity: 1;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.v1-flip__back-lista a:hover {
  color: #fff;
  opacity: 1;
}

/* Efecto spotlight: al hacer hover en uno, los demás bajan ligeramente */
.v1-flip__back-lista:has(a:hover) a:not(:hover) {
  opacity: 0.55;
}

.v1-flip__back-nombre {
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  color: inherit;
}

.v1-flip__back-nombre::before {
  content: '→';
  font-size: 10px;
  opacity: 0.5;
  flex-shrink: 0;
}

.v1-flip__back-desc {
  font-size: 10.5px;
  font-weight: 400;
  padding-left: 15px;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.65);
  opacity: 1;
}

.v1-flip__back-lista a:hover .v1-flip__back-desc {
  color: rgba(255, 255, 255, 0.95);
}

.v1-flip__back-link--dim { opacity: 0.5; }
.v1-flip__back-link--dim:hover { opacity: 1; }

.v1-flip__back-empty {
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
  font-size: 13px;
  text-align: center;
  padding: 20px 0;
}

/* ══════════════════════════════════════════════════════════
   PALETA POR CardKey
   El JS inyecta data-key="explora" desde Cards.Category (slug)
   ══════════════════════════════════════════════════════════ */
.v1-flip[data-key="explora"],
.v1-flip[data-key="explorar"] {
  --v1-bg:           #1E1A4A;
  --v1-accent:       #C4B8FF;
  --v1-tint:         #F3F1FF;
  --v1-front-accent: #4C3DC9;
}

.v1-flip[data-key="participa"],
.v1-flip[data-key="participar"] {
  --v1-bg:           #2D2380;
  --v1-accent:       #A5B4FC;
  --v1-tint:         #EAE6FD;
  --v1-front-accent: #4338CA;
}

.v1-flip[data-key="gestiona"],
.v1-flip[data-key="tramites"],
.v1-flip[data-key="tramita"] {
  --v1-bg:           #3730A3;
  --v1-accent:       #DDD6FE;
  --v1-tint:         #E2DBFB;
  --v1-front-accent: #3730A3;
}

.v1-flip[data-key="investiga"],
.v1-flip[data-key="investigar"] {
  --v1-bg:           #4C1D95;
  --v1-accent:       #D4BBFF;
  --v1-tint:         #DAD3FA;
  --v1-front-accent: #4C1D95;
}

.v1-flip[data-key="difunde"],
.v1-flip[data-key="difundir"] {
  --v1-bg:           #6D28D9;
  --v1-accent:       #EDE9FE;
  --v1-tint:         #D1C8F8;
  --v1-front-accent: #5B21B6;
}

/* ══════════════════════════════════════════════════════════
   ERES-UN — filtro de perfil
   ══════════════════════════════════════════════════════════ */
.eres-un {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 24px 0 12px;
  flex-wrap: wrap;
}

.eres-un__label {
  font-size: 15px;
  font-weight: 700;
  color: #3C3489;
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 6px;
}

.eres-un__opcion {
  font-size: 13px;
  font-weight: 400;
  color: #9188C4;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0 4px;
  font-family: inherit;
  letter-spacing: 0.01em;
  transition: color 0.18s ease,
              font-weight 0.18s ease,
              text-shadow 0.18s ease,
              transform 0.18s ease;
  display: inline-block;
}

.eres-un__opcion:hover {
  color: #2E2666;
  font-weight: 700;
  text-shadow: 0 0 12px rgba(60, 52, 137, 0.6),
               0 0 28px rgba(60, 52, 137, 0.3);
  transform: scale(1.05);
}

.eres-un__opcion--activo {
  color: #2E2666;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(60, 52, 137, 0.55),
               0 0 22px rgba(60, 52, 137, 0.25);
  transform: scale(1.05);
}

/* ══════════════════════════════════════════════════════════
   TIRA — plataformas destacadas
   ══════════════════════════════════════════════════════════ */
.tira-footer {
  padding: 32px 0 48px;
  border-top: 1px solid rgba(60, 52, 137, 0.1);
  margin-top: 20px;
}

.tira-footer__label {
  text-align: center;
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9188C4 !important;
  margin: 0 0 20px !important;
}

.tira-plataformas {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 0;
  padding: 0;
  flex-wrap: wrap;
}

.tira-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 70px;
  width: 180px;
  flex-shrink: 0;
  background: transparent;
  border: none;
  text-decoration: none;
  padding: 14px 16px 12px;
  transition: background 0.35s ease;
}

.tira-item__logo {
  max-width: 120px;
  max-height: 36px;
  width: auto;
  object-fit: contain;
  filter: invert(73%) sepia(12%) saturate(500%) hue-rotate(216deg) brightness(1.05) contrast(0.9);
  transition: filter 0.4s ease, transform 0.4s ease;
}

.tira-item__desc {
  font-size: 11px;
  line-height: 1.45;
  color: #4C3DC9;
  text-align: center;
  padding: 0 6px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.35s ease,
              max-height 0.4s ease,
              margin-top 0.35s ease,
              transform 0.35s ease;
  margin-top: 0;
}

.tira-item:hover .tira-item__logo {
  filter: invert(22%) sepia(55%) saturate(1100%) hue-rotate(222deg) brightness(0.88) contrast(1.05);
  transform: scale(1.06);
}

.tira-item:hover .tira-item__desc {
  max-height: 48px;
  opacity: 1;
  margin-top: 8px;
  transform: translateY(0);
}

/* Cuando uno tiene hover, los demás se atenúan */
.tira-plataformas:has(.tira-item:hover) .tira-item:not(:hover) .tira-item__logo {
  filter: invert(73%) sepia(12%) saturate(500%) hue-rotate(216deg) brightness(1.05) contrast(0.9) opacity(0.35);
}
 


/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .portal-v1__grid { grid-template-columns: repeat(3, 1fr); }


  .v1-flip__rule {
      border-top: 0px solid var(--v1-front-accent, #4C3DC9);
  }


}

/* ══════════════════════════════════════════════════════════
   MOBILE (≤640px) — ACORDEÓN
   Las flip cards dejan de girar en 3D y se convierten en un
   acordeón vertical: header (verbo + chevron) siempre visible,
   cuerpo (necesidad + lista de plataformas) se expande cuando
   la tarjeta tiene la clase .v1-flip--flipped (o --activa).
   No se toca el JS: se reutiliza la misma clase que ya dispara
   el giro en desktop, solo cambia lo que la CSS hace con ella.

   FIX 1 — colores planos: .v1-flip tenía el fondo fijo en #EDEAFC
   para las 5 secciones, por eso se veían todas iguales en tus
   capturas. Ahora usa var(--v1-tint), la misma variable que ya
   trae cada .v1-flip[data-key="..."] más arriba en este archivo
   para desktop — no hace falta redeclarar la paleta.

   FIX 2 — título fantasma ("Participar y crear" en blanco, apenas
   visible, detrás de la lista en tu captura): el reset de más
   arriba trae
     .portal-v1 .v1-flip .v1-flip__back-titulo {
       display: block !important; color: #fff !important; ...
     }
   esa regla tiene 3 clases de especificidad + !important, así que
   le ganaba a un simple ".v1-flip__back-titulo { display: none; }".
   Hay que igualar especificidad y sumar !important para que sí lo
   tape en mobile.
   ══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {

  .portal-v1__grid {
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: 0;
  }

  /* La tarjeta pasa de "caja 3D de alto fijo" a panel de acordeón */
  .v1-flip {
    height: auto;
    perspective: none;
    border: none;
    border-radius: 16px;
    background: var(--v1-tint, #EDEAFC);
    overflow: hidden;
  }

  .v1-flip--inactiva {
    opacity: 1;
    pointer-events: auto;
    filter: none;
  }

  .v1-flip__inner {
    position: static;
    transform: none !important;
    transition: none;
  }

  /* ── Header (antes "frente") ─────────────────────────── */
  .v1-flip__front {
    position: static;
    inset: auto;
    background: none;
    
    padding: 18px 20px;
    border-radius: 0;
    cursor: pointer;
  }

  .v1-flip--flipped{
    background: rgb(224, 213, 248) !important;
  }

  .v1-flip__front-top { display: none; }

  .v1-flip__display {
    flex: none;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    text-align: left;
  }

  /*.v1-flip__verbo {
    font-size: 20px;
    font-weight: 800;
    color: var(--v1-front-accent, #4C3DC9);
  }*/
  .v1-flip__verbo {
    font-size: clamp(21px, 6vw, 27px);
    font-weight: 900;
    letter-spacing: -.03em;
    line-height: 1;
    color: var(--acc);
  }

  /* Chevron ▾ / ▴ */
  .v1-flip__display::after {
    content: '';
    width: 9px;
    height: 9px;
    flex-shrink: 0;
    margin-left: 12px;
    border-right: 2px solid var(--v1-front-accent, #4C3DC9);
    border-bottom: 2px solid var(--v1-front-accent, #4C3DC9);
    transform: rotate(45deg);
    transition: transform 0.3s ease;
  }

  .v1-flip--flipped .v1-flip__display::after,
  .v1-flip--activa .v1-flip__display::after {
    transform: rotate(-135deg);
  }

  .v1-flip__front-foot { display: none; }

  .v1-flip__necesidad {
    color: #5B5490;
    font-size: 13px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin: 0;
    transition: max-height 0.35s ease, opacity 0.3s ease, margin 0.3s ease;
  }

  .v1-flip--flipped .v1-flip__necesidad,
  .v1-flip--activa .v1-flip__necesidad {
    max-height: 200px;
    opacity: 1;
    margin: 6px 0 0;
  }

  /* ── Cuerpo (antes "reverso") ─────────────────────────── */
  .v1-flip__back {
    position: static;
    inset: auto;
    transform: none;
    background: rgb(224, 213, 248);
    color: #2E2666;
    padding: 0 20px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease;
  }

  .v1-flip--flipped .v1-flip__back,
  .v1-flip--activa .v1-flip__back {
    max-height: 2000px;
    opacity: 1;
    padding: 4px 20px 18px;
  }

  /* FIX 2: misma especificidad (.portal-v1 .v1-flip .v1-flip__back-titulo)
     + !important que la regla que lo fuerza a mostrarse en desktop. */
  .portal-v1 .v1-flip .v1-flip__back-titulo {
    display: none !important;
  }

  .v1-flip__back-lista {
    border-top: none;
    overflow-y: visible;
    max-height: none;
    gap: 14px;
    padding: 4px 0 0;
  }

  .v1-flip__back-nombre {
    color: #2E2666;
    font-weight: 700;
    font-size: 13.5px;
  }

  .v1-flip__back-nombre::before {
    color: var(--v1-front-accent, #4C3DC9);
    opacity: 1;
  }

  .v1-flip__back-desc {
    color: #6B63A0;
    font-size: 11.5px;
  }

  .v1-flip__back-lista a:hover { color: #2E2666; }
  .v1-flip__back-lista a:hover .v1-flip__back-desc { color: #4C3DC9; }
  .v1-flip__back-lista:has(a:hover) a:not(:hover) { opacity: 1; }
}


/* Ajuste menu */
.bg-secondary-cultura .social-links a {
    width: inherit !important;
}


.v1-flip {
  background: var(--v1-tint, #EDEAFC);   /* var. por data-key, no fijo */
}
.v1-flip__front-bottom > .v1-flip__rule { display: none; }
.v1-flip__verbo { color: var(--v1-front-accent, #4C3DC9); }  /* var. por data-key */